package entity

import (
	"time"

	"shqsoft.cn/pasnj/base"
)

//IndiAccoDiviSq 个人存款认定申请审批信息
type IndiAccoDiviSq struct {
	ID          int        `gorm:"AUTO_INCREMENT;primary_key;column:ID"`
	ACID        int        `gorm:"column:ACID"`
	EMID        int        `gorm:"column:EMID"`
	User        User       `gorm:"ForeignKey:EMID"`
	SQRID       int        `gorm:"column:SQRID"`
	DSVL        float64    `gorm:"column:DSVL"`
	DSDT        *time.Time `gorm:"column:DSDT;type:date;"`
	SPSJ        time.Time  `gorm:"column:SPSJ;type:date;"`
	YY          string     `gorm:"column:YY"`
	GXBM        string     `gorm:"column:GXBM"`
	KHWD        string     `gorm:"column:KHWD"`
	KHR         *time.Time `gorm:"column:KHR;type:date"`
	ZH          string     `gorm:"column:ZH"`
	KH          string     `gorm:"column:KH"`
	KHMC        string     `gorm:"column:KHMC"`
	ZJHM        string     `gorm:"column:ZJHM"`
	TJRQ        time.Time  `gorm:"column:TJRQ;type:date"`
	ISTY        string     `gorm:"column:ISTY"`
	ISTYCaption string     `gorm:"-"`
}

//TableName 个人存款认定申请审批信息表名
func (IndiAccoDiviSq) TableName() string {
	return "T_INDI_ACCO_SPB"

}

// AfterFind 审批状态
func (i *IndiAccoDiviSq) AfterFind() (err error) {
	if i.ISTY == "0" {
		i.ISTYCaption = "待审批"
	} else if i.ISTY == "1" {
		i.ISTYCaption = "已通过"
	} else if i.ISTY == "2" {
		i.ISTYCaption = "已驳回"
	}
	return
}

//IndiAccoDiviSqEF 个人存款认定申请审批信息返回一个结构体
func IndiAccoDiviSqEF() base.EntityFunc {
	return func() interface{} {
		entity := IndiAccoDiviSq{}
		return &entity
	}
}

//IndiAccoDiviSqESF 个人存款认定申请审批信息返回一个结构体数组
func IndiAccoDiviSqESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []IndiAccoDiviSq
		return &entities
	}
}
func init() {
	relationship := []string{"User"}
	dao := base.NewDefaultDao(IndiAccoDiviSqEF(), IndiAccoDiviSqESF(), relationship)
	base.DaoPoolObj.Put("IndiAccoDiviSq", dao)
}
